package com.java.jiuyang.cloud.cleancode.errorhandle;

import org.springframework.http.HttpStatus;

/**
 * @ClassName: CustomException
 * @Description:
 * @Version: v1.0.0
 * @Author: Fu Hao
 * @Date: 2019/11/12 0012 上午 9:17
 * Modification History:
 * Date           Author      Version     Description
 * -------------------------------------------------------------
 * 2019/11/12 0012        Fu Hao      v1.0.0         创建
 */
/*自定义异常类包括三个参数：请求响应状态码，异常码和异常信息（可根据工程实际情况修改）*/
public class CustomException extends RuntimeException {
    /**
     *
     */
    private static final long serialVersionUID = -2486443993341553686L;

    private HttpStatus httpStatus;
    private int errorCode;
    public CustomException(HttpStatus httpStatus, int errorCode, String message) {
        super(message);
        this.httpStatus = httpStatus;
        this.errorCode = errorCode;

        // TODO Auto-generated constructor stub
    }

    public CustomException(String message, int errorCode, Exception e) {

        super(message, e.getCause());
        // TODO Auto-generated constructor stub
    }

    public HttpStatus getHttpStatus() {
        return httpStatus;
    }
    public void setHttpStatus(HttpStatus httpStatus) {
        this.httpStatus = httpStatus;
    }
    public int getErrorCode() {
        return errorCode;
    }
    public void setErrorCode(int errorCode) {
        this.errorCode = errorCode;
    }
}
